package com.example.myblog.service.article;

import com.example.myblog.domain.Article;
import com.example.myblog.domain.User;
import com.example.myblog.mapper.ArticleMapper;
import com.example.myblog.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: Wu YunXia
 * @Description: 文章
 * @Date: Created in 10:14 2021/08/30
 * @Modefied By:
 */
@Service
public class ArticleServiceImpl {
    @Resource
    ArticleMapper articleMapper;

    /**
     * 添加
     */
    public int addArticle(Article article){
        return articleMapper.addArticle(article);
    }
    /**
     * 修改
     */
    public int editArticle(Article article){
        return articleMapper.editArticle(article);
    }



    /**
     * 按id查找
     */
    public Article findById(int id){
        return articleMapper.findById(id);
    }
    /**
     * 牧户搜索
     */
    public List<Article>  getArticleByKeyword(String keyword){
        return articleMapper.getArticleByKeyword(keyword);
    }

    /**
     * 查找全部
     */
    public List<Article> findAll(){
        return articleMapper.findAll();
    }

    /**
     * 删除
     */
    public Boolean deleteById(int id){
        return articleMapper.deleteById(id);
    }

    /**
     * 删除
     */
    public Boolean deleteAll(){
        return articleMapper.deleteAll();
    }
}

